#include "edittexturewidget.h"
#include "ui_edittexturewidget.h"
#include <QFileDialog>

EditTextureWidget::EditTextureWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::EditTextureWidget)
{
    ui->setupUi(this);
    ui->scrollPreview->setWidgetResizable(false);
}

EditTextureWidget::~EditTextureWidget()
{
    delete ui;
}

QWidget *EditTextureWidget::previewWidget() const
{
    return ui->widgetPreview;
}

void EditTextureWidget::setFileName(QString fileName)
{
    ui->lineEditTexturePath->setText(fileName);
}

void EditTextureWidget::on_pushButtonLoadImage_clicked()
{
    QString fileName = QFileDialog::getOpenFileName(this, "Load image", QString(), "*.png");

    if(!fileName.isEmpty())
    {
        emit imageFilePathSelected(fileName);
    }
}
